<template>
  <div class="seeBox">
    <a-form :form="form">
      <a-row :gutter="24">
        <a-col :span="6">
          <a-form-model-item label="标题">
            <a-input
              disabled
              allow-clear
              :auto-size="{ minRows: 1, maxRows: 3 }"
              v-model="details.title"
            />
          </a-form-model-item>
        </a-col>
        <a-col :span="6">
          <a-form-model-item label="发布人">
            <a-input
              disabled
              allow-clear
              :auto-size="{ minRows: 1, maxRows: 3 }"
              v-model="details.createUserName"
            />
          </a-form-model-item>
        </a-col>
        <a-col :span="6">
          <a-form-model-item label="发布时间">
            <a-input
              disabled
              allow-clear
              :auto-size="{ minRows: 1, maxRows: 3 }"
              v-model="details.createDate"
            />
          </a-form-model-item>
        </a-col>
        <a-col :span="6">
          <a-form-model-item label="审批状态">
            <a-input
              disabled
              allow-clear
              :auto-size="{ minRows: 1, maxRows: 3 }"
              v-model="details.approvalStatus"
            />
          </a-form-model-item>
        </a-col>
      </a-row>

      <a-row :gutter="24">
        <a-col :span="24">
          <a-form-model-item label="描述">
            <a-textarea
              disabled
              allow-clear
              :auto-size="{ minRows: 2}"
              v-model="details.describe"
            />
          </a-form-model-item>
        </a-col>
        <a-col :span="24">
          <a-form-model-item label="图片" v-if="fileList.length > 0">
            <a-upload
              :action="baseUrl + '/fileUpload/uploadImage'"
              :headers="headers"
              :disabled="true"
              list-type="picture-card"
              :file-list="fileList"
              accept=".jpg,.png"
            >
              <div v-if="fileList.length < 1">
                <a-icon type="plus" />
                <div class="ant-upload-text">上传</div>
              </div>
            </a-upload>
          </a-form-model-item>
        </a-col>
        <!-- <a-col :span="24">
          <a-form-model-item label="视频">
            <div v-for="(item,index) in details.videoPaths" :key="index">
                <a :href="item" target="_blank">{{item}}</a>
            </div>
          </a-form-model-item>
        </a-col> -->
         <a-col :span="24" v-if="details.videoPaths.length > 0">
          <a-form-model-item label="视频">
            <div v-for="(item,index) in details.videoPaths" :key="index">
               <video width="320" height="240" class="video" controls >
               <source :src="item" type="video/mp4">
               </video>
            </div>
          </a-form-model-item>
        </a-col>
      </a-row>
    </a-form>
    <div class="footBtn" style="margin-bottom: 20px">
      <a-button
        type="primary"
        @click="$router.push('/enterprise')"
        style="margin-right: 24px"
      >
        <a-icon type="rollback" />返回</a-button
      >
    </div>
  </div>
</template>

<script>
import { getAction, putAction, postAction } from "../../http/manage";
import Editorbar from "../../components/WangEditor";
export default {
  components: {
    Editorbar,
  },
  data() {
    return {
      baseUrl: baseUrl,
      headers: {
        accessToken: sessionStorage.getItem("accessToken"),
      },
      fileList: [],
      id: this.$route.query.id,
      answer: "213",
      question: "22",
      form: this.$form.createForm(this),
      search: "/enterpriseDisplay/enterpriseDisplayGetById/",
      details: {},
      show: false,
      salary: "面议",
    };
  },

  mounted() {
    this.getdata();
    // this.$refs.editor.disableEditor();
  },
  methods: {
    getdata() {
      getAction(this.search + this.id)
        .then((res) => {
          this.details = res.data.data;
          console.log(res.data.data);
          if (
            res.data.data.imgPaths !== [] ||
            res.data.data.imgPaths != [] ||
            res.data.data.imgPaths != null
          ) {
            for (let i = 0; i < res.data.data.imgPaths.length; i++) {
              let arr = res.data.data.imgPaths[i];
              this.fileList.push({
                url: arr,
                status: "done",
                name: arr,
                uid: i,
              });
              //   this.carouselImg.push(arr);
              // (this.carouselImg);
            }
          }
        })
        .catch(() => {});
    },
  },
};
</script>

<style>
.seeBox {
  background-color: #fff;
  padding: 24px 24px 8px;
  border-radius: 4px;
  box-shadow: 0px 2px 6px 0px rgba(0, 0, 0, 0.12);
}
/* .video{
    width: 400px;
} */
</style>